package com.comp6231.common;

/**
 * 
 * @author sknarula (narula.sk@gmail.com)
 * @since September 2013
 * 
 *        This is an enum class to aid in knowing the number and name of server
 *        instances
 * 
 *        The purpose of creating a separate enum class is to make server
 *        instances extensible in future. With this, more server instances can
 *        be created without changing the main class. If the new station needs
 *        to be added, just add it here.
 * 
 */
public enum Stations {
	// SPVM, SPL, SPB

	MONTREAL(2020, 2030, "SPVM"), LONGUEUIL(2021, 2031, "SPL"), BROSSARD(2022,
			2032, "SPB");

	private final String stationType;
	private final int rmiStationValue;
	private final int udpStationValue;

	private Stations(final int rmiPort, final int udpPort, final String type) {
		stationType = type;
		rmiStationValue = rmiPort;
		udpStationValue = udpPort;
	}

	public String getPoliceStationType() {
		return stationType;
	}

	public int getPoliceStationRmiValue() {
		return rmiStationValue;
	}

	public int getPoliceStationUdpValue() {
		return udpStationValue;
	}

	public static Stations getEnumValue(String type) {
		for (Stations obj : Stations.values())
			if (obj.getPoliceStationType().equals(type))
				return obj;
		throw new IllegalArgumentException(
				"Illegal value for PoliceStationType enum.");
	}

}
